inkmap-mcp 0.3.17 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -2
- package/README.md +2 -1
- package/dist/bundles/antigravity/plugin.json +1 -1
- package/dist/bundles/antigravity/sidecars/inkmap/main.mjs +167 -32
- package/dist/bundles/codex/inkmap-codex/.codex-plugin/plugin.json +1 -1
- package/dist/bundles/codex/inkmap-codex/plugin.json +1 -1
- package/dist/bundles/harness/client.js +3 -0
- package/dist/bundles/harness/host.js +191 -55
- package/dist/bundles/harness/package.json +1 -1
- package/dist/bundles/vscode/dist/extension.js +263 -105
- package/dist/bundles/vscode/package.json +1 -1
- package/dist/cli.cjs +373 -216
- package/dist/codex.html +532 -531
- package/dist/web/app.js +50726 -50599
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/LICENSE.md
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
### 5. 隐私
|
|
28
28
|
|
|
29
|
-
-
|
|
29
|
+
- 本软件不收集、不上传你的文档内容、文件名或路径。
|
|
30
|
+
- 为了解各客户端和功能的使用情况,本软件会向 `zhiyuanv.com` 发送匿名使用统计:随机生成的安装标识、软件版本、所在客户端、操作系统类型、界面语言、试用或 Pro 状态,以及打开、编辑和各项功能的使用次数。服务器在收到统计时会记录来源 IP 地址,用于识别重复设备和判断所在地区。
|
|
30
31
|
- 平台会话凭证保存在编辑器的机密存储中,命令行工具保存在 `~/.inkmap/billing-session` 中。
|
|
31
32
|
- 购买时的付款信息由支付平台处理,我们只能看到订单号、商品和联系方式等平台提供的信息,用于确认支付、发放权益和售后。
|
|
32
33
|
|
|
@@ -68,7 +69,8 @@ Within 7 days of purchase you can ask for a full refund through the store, no qu
|
|
|
68
69
|
|
|
69
70
|
### 5. Privacy
|
|
70
71
|
|
|
71
|
-
- The Software never collects or uploads your documents
|
|
72
|
+
- The Software never collects or uploads your documents, their file names or their paths.
|
|
73
|
+
- To understand how each client and feature is used, the Software sends anonymous usage statistics to `zhiyuanv.com`: a randomly generated installation ID, the Software version, the client it runs in, the operating system type, the interface language, whether it is in trial or Pro, and how many times documents were opened or edited and features were used. When it receives them, the server records the source IP address, which is used to recognise duplicate devices and the region.
|
|
72
74
|
- The platform session is stored in the editor’s secret storage or in `~/.inkmap/billing-session` for the CLI.
|
|
73
75
|
- Payments are handled by the payment platform. We only see what it shares — order number, product and contact details — and use it to confirm payments, grant access and provide support.
|
|
74
76
|
|
package/README.md
CHANGED
|
@@ -18,7 +18,8 @@ npx -y inkmap-mcp@latest install
|
|
|
18
18
|
|
|
19
19
|
| Platform / Client | CLI Target Command | How to Open Inkmap |
|
|
20
20
|
| :--- | :--- | :--- |
|
|
21
|
-
| **Cursor / VS Code /
|
|
21
|
+
| **Cursor / VS Code / Windsurf** | `npx -y inkmap-mcp@latest install cursor` (or `vscode` / `windsurf`) | Click the top-right **Mindmap icon** on any `.md` file, or right-click -> **Open as Inkmap** |
|
|
22
|
+
| **TRAE** (not yet listed in TRAE's own marketplace) | International: `npx -y inkmap-mcp@latest install trae`. TRAE CN: download [`inkmap.vsix`](https://github.com/zhiyuanvision-lang/InkMap/releases/latest/download/inkmap.vsix) and choose **Install from VSIX** in the Extensions view | Same as above |
|
|
22
23
|
| **DeepSeek Harness** | `npx -y inkmap-mcp@latest install deepseek` | Preview any `.md` file and click **Inkmap** in the top-right preview toolbar |
|
|
23
24
|
| **Claude Desktop / Claude Code** | `npx -y inkmap-mcp@latest install claude` | Ask Claude: *"Open `README.md` with Inkmap"* |
|
|
24
25
|
| **OpenAI Codex / Antigravity** | `npx -y inkmap-mcp@latest install codex` | Ask the agent to open any `.md` outline in Inkmap (or select **Inkmap Mind Map**) |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inkmap",
|
|
3
3
|
"displayName": "Inkmap — Markdown Mind Map & Mermaid 思维导图",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.19",
|
|
5
5
|
"description": "Interactive two-way Markdown (.md, .markmap.md) mind map, mindmap, markmap, Mermaid flowchart, diagram, XMind outline & KaTeX editor: auto-opens in the Antigravity side pane with live file write-back. 在右侧面板实时双向编辑 Markdown 思维导图、脑图、流程图、大纲、架构图、组织结构图与鱼骨图。",
|
|
6
6
|
"logo": "assets/logo.svg",
|
|
7
7
|
"homepage": "https://zhiyuanv.com/software.html",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { createHash as createHash2 } from "node:crypto";
|
|
4
4
|
import { readFileSync, readdirSync } from "node:fs";
|
|
5
|
-
import { lstat as lstat3, readFile as readFile4, realpath as
|
|
5
|
+
import { lstat as lstat3, readFile as readFile4, realpath as realpath4 } from "node:fs/promises";
|
|
6
6
|
import { homedir as homedir4 } from "node:os";
|
|
7
|
-
import { basename as basename3, dirname as dirname4, extname as extname2, join as
|
|
7
|
+
import { basename as basename3, dirname as dirname4, extname as extname2, join as join5, normalize as normalize2, relative as relative3 } from "node:path";
|
|
8
8
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
9
9
|
|
|
10
10
|
// packages/core/dist/product.js
|
|
@@ -29,6 +29,52 @@ function hasAccess(state, now = Date.now()) {
|
|
|
29
29
|
return state.pro || (state.trialUntil ?? 0) > now;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// packages/core/dist/images.js
|
|
33
|
+
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
34
|
+
var startsWith = (bytes, signature, offset = 0) => [...signature].every((char, i) => bytes[offset + i] === char.charCodeAt(0));
|
|
35
|
+
function sniffImage(bytes) {
|
|
36
|
+
if (startsWith(bytes, "\x89PNG\r\n\n"))
|
|
37
|
+
return "png";
|
|
38
|
+
if (startsWith(bytes, "\xFF\xD8\xFF"))
|
|
39
|
+
return "jpg";
|
|
40
|
+
if (startsWith(bytes, "GIF87a") || startsWith(bytes, "GIF89a"))
|
|
41
|
+
return "gif";
|
|
42
|
+
if (startsWith(bytes, "RIFF") && startsWith(bytes, "WEBP", 8))
|
|
43
|
+
return "webp";
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
function decodeImageDataUrl(dataUrl) {
|
|
47
|
+
const match = typeof dataUrl === "string" ? /^data:[\w.+/-]*;base64,([A-Za-z0-9+/]*={0,2})$/.exec(dataUrl) : null;
|
|
48
|
+
if (!match)
|
|
49
|
+
return { problem: "type" };
|
|
50
|
+
if (match[1].length * 3 / 4 - 2 > MAX_IMAGE_BYTES)
|
|
51
|
+
return { problem: "size" };
|
|
52
|
+
let binary;
|
|
53
|
+
try {
|
|
54
|
+
binary = atob(match[1]);
|
|
55
|
+
} catch {
|
|
56
|
+
return { problem: "type" };
|
|
57
|
+
}
|
|
58
|
+
if (binary.length > MAX_IMAGE_BYTES)
|
|
59
|
+
return { problem: "size" };
|
|
60
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
61
|
+
const extension = sniffImage(bytes);
|
|
62
|
+
return extension ? { bytes, extension } : { problem: "type" };
|
|
63
|
+
}
|
|
64
|
+
function imageFolderName(documentFileName) {
|
|
65
|
+
const stem = documentFileName.replace(/\.(?:md|markdown)$/i, "").trim();
|
|
66
|
+
return `${/^\.*$/.test(stem) ? "images" : stem}.assets`;
|
|
67
|
+
}
|
|
68
|
+
function imageFileName(when, extension, attempt = 1) {
|
|
69
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
70
|
+
const stamp = `${when.getFullYear()}${two(when.getMonth() + 1)}${two(when.getDate())}-${two(when.getHours())}${two(when.getMinutes())}${two(when.getSeconds())}`;
|
|
71
|
+
return `image-${stamp}${attempt > 1 ? `-${attempt}` : ""}.${extension}`;
|
|
72
|
+
}
|
|
73
|
+
function imageLinkPath(folder, file) {
|
|
74
|
+
const encode = (part) => part.replace(/[%\s()<>#?[\]\\"]/g, (char) => encodeURIComponent(char).replace(/\(/g, "%28").replace(/\)/g, "%29"));
|
|
75
|
+
return `${encode(folder)}/${encode(file)}`;
|
|
76
|
+
}
|
|
77
|
+
|
|
32
78
|
// packages/core/dist/index.js
|
|
33
79
|
function sanitizeViewState(raw) {
|
|
34
80
|
if (!raw || typeof raw !== "object")
|
|
@@ -62,7 +108,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
62
108
|
import { dirname, join } from "node:path";
|
|
63
109
|
|
|
64
110
|
// packages/cli/dist/version.js
|
|
65
|
-
var INKMAP_VERSION = "0.3.
|
|
111
|
+
var INKMAP_VERSION = "0.3.19";
|
|
66
112
|
|
|
67
113
|
// packages/cli/dist/license.js
|
|
68
114
|
var ZH_LOCALE_RE = /^zh(?:[-_.]|$)/i;
|
|
@@ -147,7 +193,7 @@ function billingOrigin(raw) {
|
|
|
147
193
|
}
|
|
148
194
|
return url.origin;
|
|
149
195
|
}
|
|
150
|
-
function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHost = "", waitPollMs = WAIT_FAST_MS } = {}) {
|
|
196
|
+
function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHost = "", waitPollMs = WAIT_FAST_MS, reviewPrompt = true } = {}) {
|
|
151
197
|
const listeners = /* @__PURE__ */ new Set();
|
|
152
198
|
let current = { pro: false };
|
|
153
199
|
let trial;
|
|
@@ -158,6 +204,25 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
158
204
|
let sentAppOpen = false;
|
|
159
205
|
let detectedHost = defaultHost;
|
|
160
206
|
const pendingEvents = /* @__PURE__ */ new Map();
|
|
207
|
+
let reviewDue = false;
|
|
208
|
+
let reviewCounting = Promise.resolve();
|
|
209
|
+
const countForReview = (event, count) => {
|
|
210
|
+
reviewCounting = reviewCounting.then(async () => {
|
|
211
|
+
if (disposed || reviewDue)
|
|
212
|
+
return;
|
|
213
|
+
const usage = await readReviewUsage();
|
|
214
|
+
if (usage.done)
|
|
215
|
+
return;
|
|
216
|
+
if (event === "doc_open")
|
|
217
|
+
usage.opens += count;
|
|
218
|
+
else
|
|
219
|
+
usage.edits += count;
|
|
220
|
+
await writeReviewUsage(usage);
|
|
221
|
+
if (usage.opens >= REVIEW_MIN_OPENS && usage.edits >= REVIEW_MIN_EDITS)
|
|
222
|
+
reviewDue = true;
|
|
223
|
+
}).catch(() => {
|
|
224
|
+
});
|
|
225
|
+
};
|
|
161
226
|
let lastCheck = 0;
|
|
162
227
|
let retryAfter = 0;
|
|
163
228
|
let fastPollUntil = 0;
|
|
@@ -632,12 +697,22 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
632
697
|
});
|
|
633
698
|
}
|
|
634
699
|
return {
|
|
635
|
-
async state() {
|
|
700
|
+
async state(options) {
|
|
636
701
|
await (trial ??= startTrial());
|
|
637
702
|
const interval = !current.pro && Date.now() < fastPollUntil ? 2e3 : 6e4;
|
|
638
703
|
if (Date.now() - lastCheck >= interval && Date.now() >= retryAfter)
|
|
639
704
|
await refresh();
|
|
640
705
|
await parkUnpaidSession();
|
|
706
|
+
await reviewCounting;
|
|
707
|
+
if (options?.forUi && reviewDue && hasAccess(current)) {
|
|
708
|
+
reviewDue = false;
|
|
709
|
+
const usage = await readReviewUsage().catch(() => void 0);
|
|
710
|
+
if (usage && !usage.done) {
|
|
711
|
+
await writeReviewUsage({ ...usage, done: true }).catch(() => {
|
|
712
|
+
});
|
|
713
|
+
return { ...current, reviewPrompt: true };
|
|
714
|
+
}
|
|
715
|
+
}
|
|
641
716
|
return current;
|
|
642
717
|
},
|
|
643
718
|
async connect(mode, localeHint) {
|
|
@@ -985,6 +1060,8 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
985
1060
|
if (event !== "app_open") {
|
|
986
1061
|
pendingEvents.set(event, Math.min(1e3, (pendingEvents.get(event) ?? 0) + count));
|
|
987
1062
|
}
|
|
1063
|
+
if (reviewPrompt && !process.env.CI && (event === "doc_open" || event === "doc_edit"))
|
|
1064
|
+
countForReview(event, count);
|
|
988
1065
|
if (telemetryTimer)
|
|
989
1066
|
return;
|
|
990
1067
|
telemetryTimer = setTimeout(() => {
|
|
@@ -1057,6 +1134,25 @@ async function atomicCreateIfMissing(path, initialContent) {
|
|
|
1057
1134
|
return await readFile(path, "utf8");
|
|
1058
1135
|
}
|
|
1059
1136
|
}
|
|
1137
|
+
var REVIEW_MIN_OPENS = 5;
|
|
1138
|
+
var REVIEW_MIN_EDITS = 3;
|
|
1139
|
+
var reviewUsagePath = () => join(process.env.INKMAP_HOME || join(homedir(), ".inkmap"), "review-prompt");
|
|
1140
|
+
async function readReviewUsage() {
|
|
1141
|
+
const count = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : 0;
|
|
1142
|
+
try {
|
|
1143
|
+
const raw = JSON.parse(await readFile(reviewUsagePath(), "utf8"));
|
|
1144
|
+
return { opens: count(raw.opens), edits: count(raw.edits), done: raw.done === true };
|
|
1145
|
+
} catch {
|
|
1146
|
+
return { opens: 0, edits: 0, done: false };
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
async function writeReviewUsage(usage) {
|
|
1150
|
+
const path = reviewUsagePath();
|
|
1151
|
+
await mkdir(dirname(path), { recursive: true, mode: 448 });
|
|
1152
|
+
const temporary = path + "." + randomUUID();
|
|
1153
|
+
await writeFile(temporary, JSON.stringify(usage), { mode: 384 });
|
|
1154
|
+
await rename(temporary, path);
|
|
1155
|
+
}
|
|
1060
1156
|
async function localInstallId() {
|
|
1061
1157
|
const path = join(process.env.INKMAP_HOME || join(homedir(), ".inkmap"), "install-id");
|
|
1062
1158
|
const generated = "inst_" + randomUUID().replace(/-/g, "").slice(0, 24);
|
|
@@ -1123,10 +1219,14 @@ async function openBrowserWindow(url) {
|
|
|
1123
1219
|
// packages/cli/dist/server.js
|
|
1124
1220
|
import { createHash, randomBytes } from "node:crypto";
|
|
1125
1221
|
import { watch } from "node:fs";
|
|
1126
|
-
import { lstat as lstat2, mkdir as
|
|
1222
|
+
import { lstat as lstat2, mkdir as mkdir3, readFile as readFile3, realpath as realpath3, rename as rename2, rm as rm2, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
1127
1223
|
import { createServer } from "node:http";
|
|
1128
1224
|
import { homedir as homedir3 } from "node:os";
|
|
1129
|
-
import { basename as basename2, delimiter as delimiter2, dirname as dirname3, extname, join as
|
|
1225
|
+
import { basename as basename2, delimiter as delimiter2, dirname as dirname3, extname, join as join4, normalize, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
1226
|
+
|
|
1227
|
+
// packages/cli/dist/image-assets.js
|
|
1228
|
+
import { mkdir as mkdir2, realpath as realpath2, writeFile as writeFile2 } from "node:fs/promises";
|
|
1229
|
+
import { join as join3 } from "node:path";
|
|
1130
1230
|
|
|
1131
1231
|
// packages/cli/dist/workspace-fs.js
|
|
1132
1232
|
import { lstat, readdir, readFile as readFile2, realpath } from "node:fs/promises";
|
|
@@ -1404,6 +1504,27 @@ function createWorkspaceAccess() {
|
|
|
1404
1504
|
return { allowedRoots, assertAllowedFile };
|
|
1405
1505
|
}
|
|
1406
1506
|
|
|
1507
|
+
// packages/cli/dist/image-assets.js
|
|
1508
|
+
async function saveImageAsset(documentDir, documentFileName, image, when = /* @__PURE__ */ new Date()) {
|
|
1509
|
+
const folder = imageFolderName(documentFileName);
|
|
1510
|
+
const target = join3(documentDir, folder);
|
|
1511
|
+
await mkdir2(target, { recursive: true });
|
|
1512
|
+
if (!insideOrEqual(await realpath2(documentDir), await realpath2(target))) {
|
|
1513
|
+
throw new Error(say("\u56FE\u7247\u76EE\u5F55\u6307\u5411\u6587\u6863\u76EE\u5F55\u4E4B\u5916\uFF0C\u672A\u4FDD\u5B58\u56FE\u7247\u3002", "The pictures folder leads outside the document's folder, so nothing was saved."));
|
|
1514
|
+
}
|
|
1515
|
+
for (let attempt = 1; attempt <= 100; attempt++) {
|
|
1516
|
+
const name = imageFileName(when, image.extension, attempt);
|
|
1517
|
+
try {
|
|
1518
|
+
await writeFile2(join3(target, name), image.bytes, { flag: "wx" });
|
|
1519
|
+
return imageLinkPath(folder, name);
|
|
1520
|
+
} catch (error) {
|
|
1521
|
+
if (error.code !== "EEXIST")
|
|
1522
|
+
throw error;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
throw new Error(say("\u65E0\u6CD5\u4E3A\u56FE\u7247\u751F\u6210\u65B0\u7684\u6587\u4EF6\u540D\u3002", "Could not find a free file name for the picture."));
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1407
1528
|
// packages/cli/dist/server.js
|
|
1408
1529
|
var MAX_BODY = 20 * 1024 * 1024;
|
|
1409
1530
|
var TYPES = {
|
|
@@ -1437,8 +1558,8 @@ function docName(path) {
|
|
|
1437
1558
|
return basename2(path).replace(/\.md$/i, "").replace(/\.markmap$/i, "");
|
|
1438
1559
|
}
|
|
1439
1560
|
function viewStateFile(key) {
|
|
1440
|
-
const base = process.env.INKMAP_HOME ||
|
|
1441
|
-
return
|
|
1561
|
+
const base = process.env.INKMAP_HOME || join4(homedir3(), ".inkmap");
|
|
1562
|
+
return join4(base, "view-state", hash(key) + ".json");
|
|
1442
1563
|
}
|
|
1443
1564
|
async function readDiskViewState(key) {
|
|
1444
1565
|
try {
|
|
@@ -1449,10 +1570,10 @@ async function readDiskViewState(key) {
|
|
|
1449
1570
|
}
|
|
1450
1571
|
async function writeDiskViewState(key, state) {
|
|
1451
1572
|
const target = viewStateFile(key);
|
|
1452
|
-
await
|
|
1573
|
+
await mkdir3(dirname3(target), { recursive: true, mode: 448 });
|
|
1453
1574
|
const temp = `${target}.${process.pid}.${Date.now()}`;
|
|
1454
1575
|
try {
|
|
1455
|
-
await
|
|
1576
|
+
await writeFile3(temp, JSON.stringify(state), { mode: 384 });
|
|
1456
1577
|
await rename2(temp, target);
|
|
1457
1578
|
} finally {
|
|
1458
1579
|
await rm2(temp, { force: true }).catch(() => {
|
|
@@ -1461,7 +1582,7 @@ async function writeDiskViewState(key, state) {
|
|
|
1461
1582
|
}
|
|
1462
1583
|
async function fileSource(file, log = () => {
|
|
1463
1584
|
}) {
|
|
1464
|
-
const path = await
|
|
1585
|
+
const path = await realpath3(resolve2(file)).catch(() => resolve2(file));
|
|
1465
1586
|
if (!(await stat(path)).isFile())
|
|
1466
1587
|
throw new Error(`\u4E0D\u662F\u6587\u4EF6\uFF1A${path}`);
|
|
1467
1588
|
const dir = dirname3(path);
|
|
@@ -1471,7 +1592,7 @@ async function fileSource(file, log = () => {
|
|
|
1471
1592
|
dir,
|
|
1472
1593
|
read: () => readFile3(path, "utf8"),
|
|
1473
1594
|
async write(md) {
|
|
1474
|
-
await
|
|
1595
|
+
await writeFile3(path, md, "utf8");
|
|
1475
1596
|
log(`\u5DF2\u5199\u56DE ${path}`);
|
|
1476
1597
|
},
|
|
1477
1598
|
watch(onChange) {
|
|
@@ -1501,7 +1622,7 @@ function within(root, rel, allowAbsoluteInRoot = false) {
|
|
|
1501
1622
|
}
|
|
1502
1623
|
const resolvedRoot = resolve2(root);
|
|
1503
1624
|
const base = resolvedRoot.endsWith(sep2) ? resolvedRoot : resolvedRoot + sep2;
|
|
1504
|
-
const full = allowAbsoluteInRoot && /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? normalize(decoded) : normalize(
|
|
1625
|
+
const full = allowAbsoluteInRoot && /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? normalize(decoded) : normalize(join4(resolvedRoot, decoded));
|
|
1505
1626
|
return full.startsWith(base) ? full : null;
|
|
1506
1627
|
}
|
|
1507
1628
|
async function serve({ source: initialSource, webRoot, port = 4377, host = "127.0.0.1", log = () => {
|
|
@@ -1559,17 +1680,17 @@ data: ${JSON.stringify(data)}
|
|
|
1559
1680
|
}), 80);
|
|
1560
1681
|
};
|
|
1561
1682
|
let unwatch = activeSource.watch(scheduleRefresh);
|
|
1562
|
-
const canonicalActiveKey = async () => activeSource.key ? await
|
|
1683
|
+
const canonicalActiveKey = async () => activeSource.key ? await realpath3(activeSource.key).catch(() => activeSource.key) : void 0;
|
|
1563
1684
|
async function collectWorkspaceFiles() {
|
|
1564
1685
|
const roots = /* @__PURE__ */ new Map();
|
|
1565
1686
|
if (activeSource.key && !confineToWorkspaceRoots) {
|
|
1566
|
-
const realKey = await
|
|
1567
|
-
const projRoot = await
|
|
1687
|
+
const realKey = await realpath3(activeSource.key).catch(() => activeSource.key);
|
|
1688
|
+
const projRoot = await realpath3(await findProjectRoot(realKey)).catch(() => dirname3(realKey));
|
|
1568
1689
|
roots.set(projRoot, { path: projRoot, name: basename2(projRoot), active: true });
|
|
1569
1690
|
}
|
|
1570
1691
|
const envRoots = [...workspaceRoots, ...(process.env.INKMAP_WORKSPACES || "").split(delimiter2)].filter(Boolean);
|
|
1571
1692
|
for (const raw of envRoots) {
|
|
1572
|
-
const real = await
|
|
1693
|
+
const real = await realpath3(resolve2(raw)).catch(() => null);
|
|
1573
1694
|
if (real && !roots.has(real)) {
|
|
1574
1695
|
roots.set(real, { path: real, name: basename2(real), active: roots.size === 0 });
|
|
1575
1696
|
}
|
|
@@ -1607,7 +1728,7 @@ data: ${JSON.stringify(data)}
|
|
|
1607
1728
|
throw notMarkdown();
|
|
1608
1729
|
const resolvedCandidate = resolve2(candidatePath);
|
|
1609
1730
|
const rawStat = await lstat2(resolvedCandidate).catch(() => null);
|
|
1610
|
-
const realTarget = await
|
|
1731
|
+
const realTarget = await realpath3(resolvedCandidate).catch(() => null);
|
|
1611
1732
|
const targetStat = realTarget ? await stat(realTarget).catch(() => null) : null;
|
|
1612
1733
|
if (!rawStat || rawStat.isSymbolicLink() && !trustCaller || !realTarget || !targetStat?.isFile() || targetStat.size > MAX_MARKDOWN_BYTES) {
|
|
1613
1734
|
throw new HttpError(403, zh() ? "\u8BF7\u9009\u62E9 5 MiB \u4EE5\u5185\u7684\u666E\u901A Markdown \u6587\u4EF6\u3002" : "Choose a regular Markdown file up to 5 MiB.");
|
|
@@ -1762,8 +1883,22 @@ data: ${JSON.stringify(data)}
|
|
|
1762
1883
|
return json(res, 200, { version });
|
|
1763
1884
|
});
|
|
1764
1885
|
}
|
|
1886
|
+
if (url.pathname === "/api/image" && req.method === "POST") {
|
|
1887
|
+
if (!sameOriginWrite())
|
|
1888
|
+
return json(res, 403, { error: "forbidden" });
|
|
1889
|
+
const image = decodeImageDataUrl(JSON.parse(await readBody(req)).dataUrl);
|
|
1890
|
+
if ("problem" in image) {
|
|
1891
|
+
return json(res, image.problem === "size" ? 413 : 415, { error: image.problem });
|
|
1892
|
+
}
|
|
1893
|
+
if (!hasAccess(await license?.state() ?? { pro: false }))
|
|
1894
|
+
return json(res, 403, { error: "Inkmap trial expired" });
|
|
1895
|
+
return await serialized(async () => {
|
|
1896
|
+
const name = activeSource.key ? basename2(activeSource.key) : activeSource.name;
|
|
1897
|
+
return json(res, 200, { path: await saveImageAsset(activeSource.dir, name, image) });
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1765
1900
|
if (url.pathname === "/api/license" && req.method === "GET")
|
|
1766
|
-
return json(res, 200, await license?.state() ?? { pro: false });
|
|
1901
|
+
return json(res, 200, await license?.state({ forUi: true }) ?? { pro: false });
|
|
1767
1902
|
if (url.pathname === "/api/open" && req.method === "POST") {
|
|
1768
1903
|
if (!sameOriginWrite())
|
|
1769
1904
|
return json(res, 403, { error: "forbidden" });
|
|
@@ -1877,8 +2012,8 @@ data: ${JSON.stringify(data)}
|
|
|
1877
2012
|
if (url.pathname.startsWith("/doc-assets/")) {
|
|
1878
2013
|
let asset = within(activeSource.dir, url.pathname.slice("/doc-assets/".length), true);
|
|
1879
2014
|
if (asset) {
|
|
1880
|
-
const root = await
|
|
1881
|
-
asset = await
|
|
2015
|
+
const root = await realpath3(activeSource.dir).catch(() => null);
|
|
2016
|
+
asset = await realpath3(asset).catch(() => null);
|
|
1882
2017
|
const allowedExt = sidebar ? /\.(?:png|jpe?g|gif|webp|avif|bmp|ico)$/i : /\.(?:png|jpe?g|gif|webp|avif|bmp|ico|svg)$/i;
|
|
1883
2018
|
if (!root || !asset || !insideOrEqual(root, asset) || !allowedExt.test(asset))
|
|
1884
2019
|
asset = null;
|
|
@@ -1937,7 +2072,7 @@ data: ${JSON.stringify(data)}
|
|
|
1937
2072
|
|
|
1938
2073
|
// packages/antigravity/src/main.mjs
|
|
1939
2074
|
var __dirname = dirname4(fileURLToPath2(import.meta.url));
|
|
1940
|
-
var defaultWebRoot =
|
|
2075
|
+
var defaultWebRoot = join5(__dirname, "web");
|
|
1941
2076
|
var SidecarResponse = class {
|
|
1942
2077
|
constructor(body, { contentType = "text/plain", status = 200, headers } = {}) {
|
|
1943
2078
|
this.body = body;
|
|
@@ -2038,7 +2173,7 @@ function createAntigravitySidecar({
|
|
|
2038
2173
|
}
|
|
2039
2174
|
return { files: items, target };
|
|
2040
2175
|
}
|
|
2041
|
-
const rawHtml = readFileSync(
|
|
2176
|
+
const rawHtml = readFileSync(join5(webRoot, "index.html"), "utf8");
|
|
2042
2177
|
const cspMeta = `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob: https:; font-src 'self' data:; base-uri 'none'; form-action 'none'; object-src 'none'">`;
|
|
2043
2178
|
app.page("/", () => {
|
|
2044
2179
|
const osLoc = detectOsLocale();
|
|
@@ -2047,18 +2182,18 @@ function createAntigravitySidecar({
|
|
|
2047
2182
|
<script src="/preload.js"></script>
|
|
2048
2183
|
<script src="/bridge.js"></script>`);
|
|
2049
2184
|
});
|
|
2050
|
-
const bridgeJs = readFileSync(
|
|
2185
|
+
const bridgeJs = readFileSync(join5(__dirname, "bridge.js"), "utf8");
|
|
2051
2186
|
app.page("/bridge.js", () => bridgeJs);
|
|
2052
2187
|
app.api("/bridge.js", () => new SidecarResponse(bridgeJs, { contentType: "application/javascript; charset=utf-8" }), "GET");
|
|
2053
2188
|
let preloadedAppJs = null;
|
|
2054
2189
|
try {
|
|
2055
|
-
preloadedAppJs = readFileSync(
|
|
2190
|
+
preloadedAppJs = readFileSync(join5(webRoot, "app.js"), "utf8");
|
|
2056
2191
|
app.page("/app.js", () => preloadedAppJs);
|
|
2057
2192
|
} catch {
|
|
2058
2193
|
}
|
|
2059
2194
|
function registerStaticDir(dir, prefix = "") {
|
|
2060
2195
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
2061
|
-
const full =
|
|
2196
|
+
const full = join5(dir, entry.name);
|
|
2062
2197
|
const route = `${prefix}/${entry.name}`;
|
|
2063
2198
|
if (entry.isDirectory()) {
|
|
2064
2199
|
registerStaticDir(full, route);
|
|
@@ -2238,7 +2373,7 @@ function createAntigravitySidecar({
|
|
|
2238
2373
|
}
|
|
2239
2374
|
return { ok: true };
|
|
2240
2375
|
}), "POST");
|
|
2241
|
-
app.api("/api/license", async () => await license.state(), "GET");
|
|
2376
|
+
app.api("/api/license", async () => await license.state({ forUi: true }), "GET");
|
|
2242
2377
|
app.api("/api/checkout", async (data) => {
|
|
2243
2378
|
const locale = typeof data?.locale === "string" ? data.locale : void 0;
|
|
2244
2379
|
const url = await license.connect("restore", locale);
|
|
@@ -2263,11 +2398,11 @@ function createAntigravitySidecar({
|
|
|
2263
2398
|
const rel = typeof data?.path === "string" ? data.path.replace(/\?.*$/, "") : "";
|
|
2264
2399
|
if (!file || !rel) return notFound();
|
|
2265
2400
|
try {
|
|
2266
|
-
const dir = await
|
|
2401
|
+
const dir = await realpath4(dirname4(file));
|
|
2267
2402
|
const decoded = decodeURIComponent(rel);
|
|
2268
|
-
const candidate = /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? normalize2(decoded) : normalize2(
|
|
2403
|
+
const candidate = /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? normalize2(decoded) : normalize2(join5(dir, decoded));
|
|
2269
2404
|
if (!insideOrEqual(dir, candidate) || candidate === dir) return notFound();
|
|
2270
|
-
const realAsset = await
|
|
2405
|
+
const realAsset = await realpath4(candidate);
|
|
2271
2406
|
if (!insideOrEqual(dir, realAsset) || !/\.(?:png|jpe?g|gif|webp|avif|bmp|ico|svg)$/i.test(realAsset)) return notFound();
|
|
2272
2407
|
const info = await lstat3(realAsset);
|
|
2273
2408
|
if (!info.isFile() || info.size > MAX_MARKDOWN_BYTES) return notFound();
|
|
@@ -2300,7 +2435,7 @@ function createAntigravitySidecar({
|
|
|
2300
2435
|
}
|
|
2301
2436
|
if (process.env.ANTIGRAVITY_SIDECAR_WEB_PORT) {
|
|
2302
2437
|
const sdk = await import("sidecar_sdk").catch(
|
|
2303
|
-
() => import(pathToFileURL(
|
|
2438
|
+
() => import(pathToFileURL(join5(homedir4(), ".gemini", "config", "node_modules", "sidecar_sdk", "index.mjs")).href)
|
|
2304
2439
|
);
|
|
2305
2440
|
const { app } = createAntigravitySidecar({ app: new sdk.SidecarApp() });
|
|
2306
2441
|
app.run();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inkmap-codex",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "Interactive two-way Markdown mind map (markmap), Mermaid flowchart & XMind outline editor | 双向编辑 Markdown 思维导图、脑图、流程图与大纲",
|
|
5
5
|
"homepage": "https://zhiyuanv.com/software.html",
|
|
6
6
|
"repository": "https://github.com/zhiyuanvision-lang/InkMap",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "inkmap-codex",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.19",
|
|
5
5
|
"description": "Interactive two-way Markdown mind map (markmap), Mermaid flowchart & XMind outline editor | 双向编辑 Markdown 思维导图、脑图、流程图与大纲",
|
|
6
6
|
"homepage": "https://zhiyuanv.com/software.html",
|
|
7
7
|
"repository": "https://github.com/zhiyuanvision-lang/InkMap",
|
|
@@ -41,6 +41,9 @@ function billingFlowUrl(raw, origin, mode, legacy = false) {
|
|
|
41
41
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
42
42
|
var TRIAL_MS = 7 * DAY_MS;
|
|
43
43
|
|
|
44
|
+
// packages/core/dist/images.js
|
|
45
|
+
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
46
|
+
|
|
44
47
|
// packages/harness/src/shared.mjs
|
|
45
48
|
var packageName = true ? "dsh-inkmap" : "dsh-inkmap";
|
|
46
49
|
var kind = "inkmap-markdown";
|